<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="shortcut icon" type="image/x-icon" href="{{URL::asset('handan/images/logo-icon.png')}}" />
    <link rel="stylesheet" href="{{URL::asset('newmobile/css/public.css') }}"/>
    <link rel="stylesheet" href="{{URL::asset('newmobile/css/analyst.css') }}"/>
    <title>潜力榜</title>
    <script src="{{URL::asset('public_js/jquery-3.2.1.min.js')}}"></script>
    <script src="{{URL::asset('newmobile/js/public.js') }}"></script>
    <script src="{{URL::asset('newmobile/js/analyst.js') }}"></script>
</head>
<body>

	<div class="l_btn_tab">
			<!-- 总收益曲线图 -->
			@include('newmobile.profitchart')
			<!--tab内容-->
			<div class="l_list_con">
				<div class="l_list l_list_show">
					<ul>
						<li>
							<!--交易大导航-->
							<div class="l_master_nav">
								<div class="l_left_nav">
									潜力榜
								</div>
								<div class="l_right_nav" onclick="rightNav();">
									<span>变更榜单</span>
									<span><img src="{{URL::asset('newmobile/images/new_analyst/replace_btn.png') }}" alt=""></span>
								</div>
							</div>							
							<!--筛选列表-->
							<section class="filter2">
								<ul>
									<li class="active" onclick="window.location.href='{{url("/")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/qianlibang.png') }}" alt="">
										</span>
										<span class="txt">潜力榜</span>
									</li>
									<li onclick="window.location.href='{{url("/lianshengbang")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/lianshengbang-hui.png') }}" alt="">
										</span>
										<span class="txt">连胜榜</span>
									</li>
									<!-- <li onclick="window.location.href='{{url("/duanweibang")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/duanwei-hui.png') }}" alt="">
										</span>
										<span class="txt">段位榜</span>
									</li> -->
									<li onclick="window.location.href='{{url("/wendingzhishu")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/wendingzhishu-hui.png') }}" alt="">
										</span>
										<span class="txt">稳定指数</span>
									</li>
									<li onclick="window.location.href='{{url("/fengbaobi")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/fengbaobi-hui.png') }}" alt="">
										</span>
										<span class="txt">风报比</span>
									</li>
									<li onclick="window.location.href='{{url("/shenglvbang")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/shenglv-hui.png') }}" alt="">
										</span>
										<span class="txt">胜率榜</span>
									</li>
									<li onclick="window.location.href='{{url("/fanxiangbang")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/fanxiang-hui.png') }}" alt="">
										</span>
										<span class="txt">反向榜</span>
									</li>
									<li onclick="window.location.href='{{url("/tuijianbang")}}'">
										<span class="img">
											<img src="{{URL::asset('newmobile/images/new_icon/fanxiang-hui.png') }}" alt="">
										</span>
										<span class="txt">推荐榜</span>
									</li>
								</ul>
							</section>
							<!--区域-->
							@foreach ($list as $key=>$val)
							<section>
								<div class="l_master_title">
									<section onclick="kaiDetails(this);">
									<!--头像-->
										<div class="photo" onclick="mastercenter('{{$val->id}}',event);">
											<div><img src="@if($val->photo) {{ $val->photo}} @else {{ URL::asset('ucenter/images/head.png')}} @endif" alt="" /></div>
											<!-- <div><img src="{{URL::asset('mobile/image/v.png') }}" alt="" /></div> -->
										</div>
									<!--用户名-->
										<div class="uname">
											<div class="name">{{ $val->username }}</div>
											<div class="img">
												<span>
                                                    <img src="@if($val->authstatus == 2) {{ URL::asset('newmobile/images/new_analyst/r_master.png') }} @else {{ URL::asset('newmobile/images/new_analyst/t_star.png') }} @endif" alt="">
                                                </span>
                                                <span>
                                                    @if($val->authstatus == 2)
                                                        认证大师
                                                    @else
                                                        明日之星
                                                    @endif
                                                </span>
											</div>
										</div>
									<!--段位-->
										<div class="dan">
											<div class="danInfo">
												<p>{{round($val->week_final_point,2)}}</p>
												<p>周盈利</p>
											</div>
										</div>

									</section>
									@if($val->id == session('eai')['id'])
                                            <!--我看我自己-->
                                    @elseif($val->status == 1) <!--已订阅-->
                                        <button style="background-color: #4F5660;" onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="{{$val->status}}" direction="{{$val->direction}}">编辑</button>
                                    @else
                                        <button onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="3" direction="3">订阅</button>
                                    @endif
								</div>
								<div class="l_master_detail new_master_detail" style="background: #161a21;">
									<div class="detail new_detail">
										<!--图表-->
										<div class="l_left_chart">
											<div class='mChart' id='{{$val->username}}' style="width: 3.923rem; height: 3.092rem;"></div>
										</div>
										<script>
		                                    // 图表数据
		                                    var x_chart_time  = '{{$val->timesstr}}';
		                                    var x_chart_point = '{{$val->pointstr}}';
		                                    x_chart_point     = x_chart_point.split(',');
		                                    var x_chart_data  = [];
		                                    x_chart_point.forEach(function(data,index,arr){
		                                        x_chart_data.push(+data);
		                                    });
		                                    profit('{{$val->username}}',[x_chart_time.split(','),x_chart_data]);
		                                    function profit(id,data){
											    var t = this;
											    return new Highcharts.Chart({
											        chart: {
											            renderTo: id,
											            type: "areaspline",
											            zoomType: "xy",
											            backgroundColor: '#171922'
											        },
											        title: {
											            text : null
											        },
											        subtitle: {
											            text: null,
											            align: 'left',
											            verticalAlign: 'bottom'
											        },
											        colors: ["#ffc766"],
											        legend: {
											            enabled: false
											        },
											        credits: {
											            enabled: false
											        },
											        exporting: {
											            enabled:false
											        },
											        xAxis: {
											            lineWidth: 0, //去掉坐标轴
											            gridLineWidth: 0,
											            tickLength: 0, // 去掉坐标轴刻度线
											            categories:data[0],
											            labels: {
											                enabled: !1
											            }
											        },
											        yAxis: {
											            gridLineWidth: 0,
											            labels: {// 去掉Y轴
											                enabled: !1
											            },
											            title: {
											                text: null
											            }
											        },
											        tooltip: {
											            style: {
											                color: "white"
											            },
											            enabled : false, // 是否启用提示框， 默认启用
											            borderWidth: 1,
											            shadow: !1,
											            shared: !0,
											            backgroundColor: 'rgba(0,0,0)',   // 背景颜色
											            borderColor: '#e99d32',       // 边框颜色
											            formatter : function (){ // 提示框格式化字符串
											                var s;
											                $.each(this.points ,function(){
											                    s = '<b>总收入: ' + this.y+'点'+'</b><br/>';
											                });
											                s += '<b>截止: '+this.x+'</b>';
											                return s;
											            }
											        },
											        plotOptions: {
											            areaspline: {
											                fillColor: {
											                    linearGradient: {
											                        x1: 0,
											                        y1: 0,
											                        x2: 0,
											                        y2: 1
											                    },
											                    stops: [
											                        [0, "#171922"],
											                        [1, Highcharts.Color("#171922" , "#171922").setOpacity(0).get('rgba')]
											                    ]
											                },
											                marker: {
											                    radius: 0,
											                    fillColor: "white",
											                    lineWidth: 1,
											                    lineColor: "#ffc766"
											                },
											                lineWidth: 1,
											                states: {
											                    hover: {
											                        lineWidth: 1
											                    }
											                },
											                threshold: null
											            },
											            series: {
											                lineColor: "#e99d32"
											            }
											        },
											        series: [{
											            name: "盈利点位",
											            data: data[1]
											        }]
											    })
											}
		                                </script>
										
										<div class="l_right_data">
											<div>
												<p class="num">{{round($val->winrate,2)}}%</p>
												<p class="txt">周胜率</p>
											</div>
											<div>
												<p class="num">{{ $val -> bili }}</p>
												<p class="txt">盈亏比</p>
											</div>
											<div>
												<p class="num">{{ $val -> ordernum }}</p>
												<p class="txt">周单量</p>
											</div>
											<div class="seeDetail" onclick="window.location.href='{{url("/showinfo?id=$val->id")}}'">查看详情</div>
											<!-- onclick="weekRank({{(($list->currentPage()-1)*10)+$key+1}},{{$val->id}},event);" style="cursor: pointer;" -->
										</div>
									</div>
								</div>
							</section>
							@endforeach
						</li>									
					</ul>
				</div>
				<div id="l_weekBang"></div>
				<!-- 分页 -->
                <div  class="pagediv" style="text-align: center;">
                    @if($list->currentPage() != 1 && $list->currentPage() != 0)
                        <a href="javascript:void(0)" onclick='gotopage(0)' style="background-color:#3b9ce0">上一页</a>
                    @else
                        <a href="javascript:void(0)" style="background-color:#c2c4c9">上一页</a>
                    @endif
                        <span style="color:#3b9ce0">{{ $list->currentPage() }}</span>

                    @if($list->currentPage() != $list->lastPage() && $list->currentPage()<$list->lastPage())
                        <a href="javascript:void(0)"  onclick='gotopage(1)' style="background-color:#3b9ce0">下一页</a>
                    @else
                        <a href="javascript:void(0)" style="background-color:#c2c4c9">下一页</a>
                    @endif
                    <!-- <span>共  {{$list->total()}} 条记录</span>
                    <span>共 {{ $list->lastPage() }} 页</span> -->
                </div>
			</div>
			<!--订阅按钮弹层-->
			<div class="follow_btn" id="follow_btn">
				<div>
					<div class="bor">
						<span myAttr = '0' class=""></span>
					</div>
					正向订阅
				</div>
				<div></div>
				<div>
					<div class="bor">
						<span myAttr = '1' class=""></span>
					</div>
					反向订阅
				</div>
				<div>
					<div class="squar">
				       <input type="checkbox" value="None" id="squar" name="check" />
				       <label for="squar" id="squar">
				       		<span></span>
				       </label>
				    </div>
					<span>我已阅读并同意<a href="{{url('/agree')}}">《订阅协议》</a></span>
				</div>
				<div>
					<span onclick="cancle();">取消</span>
					<span onclick="sure(this);">确定</span>
				</div>
				<!--取消订阅-->
				<div class="cancel_follow" id="gendancancle" onclick="follow(0,0,this);">
					取消订阅
				</div>
			</div>
	</div>
<div style="height: 9rem;"></div>
@include('newmobile.footer')
@include('mobile.msg')
</body>
</html>
<style>
	/*底部行情应用样式*/
	footer ul li:nth-child(1) a {
		color: #3B9CE0;
	}
	footer ul li:nth-child(1) a i {
	  background: url("{{URL::asset('mobile/image/fxs_icond.png')}}") no-repeat center / cover;
	}
</style>
<script>
	var bdlists = "{{ url('/bdlists') }}";
	var aid       = 0;
    var analyst_username = '';
    var gotofllow = "{{url('/fllow')}}";
    var status    = 3;//是否订阅
    var direction = 3;//订阅方向
    var gotologin = "{{url('/mlogin')}}";
    //订阅按钮
    function gendan(obj) {
    	$(obj).removeAttr("onclick");
	    var islogin = "<?php echo Session('eai')['tel']?>";
	    if(!islogin){
	        //用户未登录
	        msg('请先登录');
	        setTimeout(function(){
	        	window.location.href = gotologin;
	        },2000)
	        return false;
	    }
	    var infofinish = '{{$infofinish}}';
	    if(infofinish == 1){
	        var gowanshan = "{{url('/authenticate?id=info')}}";
	        $('.popUp').hide();
	        msg('请完善资料');
	        window.setTimeout(window.location.reload(),2000);
	        return false;
	    }else{
	  		$('.follow_btn').show();
	        aid              = $(obj).attr('analyst_id');
	        analyst_username = $(obj).attr('analyst_username');
	        status           = $(obj).attr('status');
	        direction        = $(obj).attr('direction');
	        var button_html = $('.l_master_title button').html();
	        if(button_html == "订阅") {
	            var cancleBtn=$(".foot_right>input");
	            cancleBtn.css({"visibility":"hidden"});
	        }
	        if(button_html == "编辑") {
	            var thisBtn=this;
	        }
	        if(status == 1){
	            $('#gendancancle').show();
	            $('.follow_btn').attr('id','follow_btn_cancel');
	        }else{
	            $('#gendancancle').hide();
	        }
	    }
	}
	//去交易大师中心
	function mastercenter(userid,event){
		//取消事件冒泡
		var e=arguments.callee.caller.arguments[0]||event;
		if (e && e.stopPropagation) {
			e.stopPropagation();
		} else if (window.event) {
			window.event.cancelBubble = true;
		}
		var gomastercenter   = "{{url('/mastercenter')}}";
		window.location.href = gomastercenter+'?analyst_id='+userid;
	}
	// 分页
    function gotopage(types){
        var page = "{{$list->currentPage()}}" ;
        if(types == 0) {
            page = page == 1?page:(Number(page)-Number(1));
        }else{
            var lastpage = "{{$list->lastPage()}}";
            page = page == lastpage?page:(Number(page)+Number(1));
        }
        window.location.href = "{{ URL('/qianlibang?page=') }}"+page;
    }
    // 点击查询详情按钮
    var doinfourl = '{{url("/newshowinfo")}}';
    // 周榜分析师详情界面开始lang
	function weekRank(ranking,userid,event){
	    $("#l_weekBang").show();
	    $('#mask').show();
	    // 禁用滚动条
	    var top = document.body.scrollTop;
	    $(document).on('scroll.unable',function (e) {
	        $(document).scrollTop(top);
	    })
	    if(event.stopPropagation){
	        event.stopPropagation();
	    }else{
	        window.event.cancelBubble();
	    }
	     $.ajax({
	         url: doinfourl,
	         type: "POST",
	         data:  {userid:userid},
	         headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
	         dataType:'json',
	         async:false,
	         success: function (data) {
	             if(data.status == 1){
	                 layer.msg(data.msg,{time:1000});
	             }else{
	                 var str='';
	                 str+='<div class="weekBang_close" onclick="weekBangclose()"><img src="{{ URL::asset('/rankinglist/images/close2.png') }}" alt=""></div>';
	                 str+='<div id="l_scroll" class="l_scroll"><div class="l_bar" id="l_bar"></div></div>';
	                 str+='<div class="bang_left">';
	                 str+='<div class="bang_pic"><div id="weekBang_chart" style="width:157px;height:70px;"></div></div>';
	                 str+='<div class="bang_term"><span>第</span><span style="font-size:48px;color: #20222c;margin: 0 8px;">'+ranking+'</span><span>名</span></div>';
	                 str+='<div class="bang_line"></div>';
	                 str+='<div class="bang_muqian">目前名次</div></div>';
	                 str+='<div id="bang_right" class="bang_right"><ul id="content">';
	                 str += '<li class="bang_title"><div>单号</div><div>品种</div><div>方向</div><div>入场价格</div><div>平仓价格</div><div>平仓时间</div><div>最终盈亏</div></li>';
	                 
	                for(var i=0;i<data.trendpointobj.length;i++) {
	                     str += '<li>';
	                     str += '<div>'+data.trendpointobj[i].tradeid+'</div>';
	                     str += '<div>'+data.trendpointobj[i].typename+'</div><div>';
	                     if(data.trendpointobj[i].buy_status == 1){
	                         str += '卖出';
	                     }else{
	                         str += '买入';
	                     }
	                     str += '</div><div>'+data.trendpointobj[i].begin_point+'</div>';
	                     str += '<div>'+data.trendpointobj[i].end_point+'</div>';
	                     str += '<div><span>'+UnixToDate(data.trendpointobj[i].end_time,true,'',0)+'</span><span>'+UnixToDate(data.trendpointobj[i].end_time,false,'',1)+'</span></div>';
	                     if((data.trendpointobj[i].final_point+5) >0 ){
	                         str += '<div style="color:red">'+(data.trendpointobj[i].final_point+5).toFixed(2)+'</div>';
	                     }else{
	                         str += '<div style="color:green">'+(data.trendpointobj[i].final_point+5).toFixed(2)+'</div>';
	                     }
	                     str += '</li>';
	                 }
	                 str+='</ul></div>';

	                 $('#l_weekBang').html(str);
	             }
	         }
	     });
	}
</script>

